<template>
  <div>
    <Head></Head>
  <div class="main">
    <div>
      <div class="content">
        <div class="content-box">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            class="demo-ruleForm"
          >
          <el-form-item>
            <div class="birthday">
              <div class="birthday-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>主体性质</span>
              </div>
              <div class="birthday-option">
                <el-form-item prop="nature">
                  <el-select
                    clearable
                    v-model="ruleForm.nature"
                    class="elinput-left"
                    placeholder="请选择主体性质"
                    prop="nature"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </div>
          </el-form-item>
          
          <el-form-item>
            <div class="birthday">
              <div class="birthday-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>姓名</span>
              </div>
              <div class="birthday-option">
                <el-form-item prop="name">
                  <el-input
                    clearable
                    v-model="ruleForm.name"
                    class="elinput-left"
                    placeholder="请输入权属人姓名"
                  ></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form-item>

          <el-form-item>
            <div class="birthday">
              <div class="birthday-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>提供证件类型</span>
              </div>
              <div class="birthday-option">
                <el-form-item prop="certificate">
                  <el-select
                    clearable
                    v-model="ruleForm.certificate"
                    class="elinput-left"
                    placeholder="请选择主体性质"
               
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </div>
          </el-form-item>
          

            <!-- 上传图片 -->
            <div class="uploading">
              <el-upload action="#" list-type="picture-card" :auto-upload="false">
                <!-- <i slot="default" class="el-icon-plus"></i> -->
                <div class="uploading-bg">
                  <img src="../../images/portrait.png" alt />
                  <p>上传身份证人像面</p>
                </div>
                <div slot="file" slot-scope="{file}">
                  <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
                  <span class="el-upload-list__item-actions">
                    <span
                      class="el-upload-list__item-preview"
                      @click="handlePictureCardPreview(file)"
                    >
                      <i class="el-icon-zoom-in"></i>
                    </span>
                    <!-- 下载到本地 -->
                    <!-- <span
                      v-if="!disabled"
                      class="el-upload-list__item-delete"
                      @click="handleDownload(file)"
                    >
                      <i class="el-icon-download"></i>
                    </span>-->
                    <span
                      v-if="!disabled"
                      class="el-upload-list__item-delete"
                      @click="handleRemove(file)"
                    >
                      <i class="el-icon-delete"></i>
                    </span>
                  </span>
                </div>
              </el-upload>
              <el-dialog :visible.sync="dialogVisible">
                <img width="100%" :src="dialogImageUrl" alt />
              </el-dialog>

              <!-- 国徽面 -->
              <el-upload
                action="#"
                list-type="picture-card"
                :auto-upload="false"
                style="margin-left: 10px;"
              >
                <!-- <i slot="default" class="el-icon-plus"></i> -->
                <div class="uploading-bg">
                  <img src="../../images/portrait.png" alt />
                  <p>上传身份证国徽面</p>
                </div>
                <div slot="file" slot-scope="{file}">
                  <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
                  <span class="el-upload-list__item-actions">
                    <span
                      class="el-upload-list__item-preview"
                      @click="handlePictureCardPreview(file)"
                    >
                      <i class="el-icon-zoom-in"></i>
                    </span>
                    <!-- 下载到本地 -->
                    <!-- <span
                      v-if="!disabled"
                      class="el-upload-list__item-delete"
                      @click="handleDownload(file)"
                    >
                      <i class="el-icon-download"></i>
                    </span>-->
                    <span
                      v-if="!disabled"
                      class="el-upload-list__item-delete"
                      @click="handleRemove(file)"
                    >
                      <i class="el-icon-delete"></i>
                    </span>
                  </span>
                </div>
              </el-upload>
              <el-dialog :visible.sync="dialogVisible">
                <img width="100%" :src="dialogImageUrl" alt />
              </el-dialog>
            </div>

            <el-form-item>
            <div class="birthday">
              <div class="birthday-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>证件号码</span>
              </div>
              <div class="birthday-option">
                <el-form-item prop="IdNum">
                  <el-input
                    clearable
                    v-model="ruleForm.IdNum"
                    class="elinput-left"
                    placeholder="请输入单位名称"
                  ></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form-item>

          <el-form-item>
            <div class="birthday">
              <div class="birthday-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>联系方式</span>
              </div>
              <div class="birthday-option">
                <el-form-item prop="mobile">
                  <el-input
                    clearable
                    v-model="ruleForm.mobile"
                    class="elinput-left"
                    placeholder="请输入手机号"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="mailbox">
                  <el-input
                    clearable
                    v-model="ruleForm.mailbox"
                    class="elinput-left"
                    placeholder="请输入邮箱"
                  ></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form-item>

          <el-form-item>
            <div class="checkbox">
              <div class="checkbox-title">
                <img style="width: 18px;height: 18px;" src="../../images/star.png" alt />
                <span>所在地区</span>
              </div>
              <div class="checkbox-option">
                <el-form-item prop="province">
                  <el-select
                    clearable
                    v-model="ruleForm.province"
                    class="elinput-left"
                    placeholder="请选择省"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="cantonal">
                  <el-select
                    clearable
                    v-model="ruleForm.cantonal"
                    class="elinput-left"
                    placeholder="请选择市"
                    
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="district">
                  <el-select
                    clearable
                    v-model="ruleForm.district"
                    class="elinput-left"
                    placeholder="请选择区"
                 
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="detailed" >
                  <el-input
                    clearable
                    v-model="ruleForm.detailed"
                    class="elinput-left"
                    placeholder="请输入详细地址"
                  ></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form-item>

          <!-- 提交 -->
          <el-form-item class="submit">
            <el-button type="primary" class="submit-but" @click="submitForm('ruleForm')">提交并下一步</el-button>
          </el-form-item>

 

          </el-form>
        </div>
      </div>
      <div class="main-their">中国数字人知识产权存证保护平台</div>
    </div>
  </div>
  </div>
</template>

<script>
import Head from '../../components/Head'
export default {
  name: "personalView",
  components: {Head},
  data() {
    return {
      ruleForm: {
        nature: "",
        name: "",
        certificate:"",
        IdNum:"",
        mobile:"",
        mailbox:"",
        province:"",
        cantonal:"",
        district:"",
        detailed:""
      },
      rules: {
        nature: [
          { required: true, message: "请选择主体性质", trigger: "blur" }
        ],
        name: [
          { required: true, message: "请输入姓名", trigger: "blur" },
        ],
        certificate: [
          { required: true, message: "请选择证件类型", trigger: "blur" }
        ],    
        IdNum: [
          { required: true, message: "请输入身份证号", trigger: "blur" }
        ],
        mobile: [
          { required: true, message: "请输入手机号", trigger: "blur" }
        ],
        mailbox: [
          { required: true, message: "请输入邮箱", trigger: "blur" }
        ],
        province: [
          { required: true, message: "请选择省", trigger: "blur" }
        ],
        cantonal: [
          { required: true, message: "请选择市", trigger: "blur" }
        ],
        district: [
          { required: true, message: "请选择区", trigger: "blur" }
        ],
        detailed: [
          { required: true, message: "请输入详细地址", trigger: "blur" }
        ],
        
      },
      options: [
        {
          value: "选项1value",
          label: "选项1"
        },
        {
          value: "选项2value",
          label: "选项2"
        },
        {
          value: "选项3value",
          label: "选项3"
        },
        {
          value: "选项4value",
          label: "选项4"
        },
        {
          value: "选项5value",
          label: "选项5"
        }
      ],
      // 上传图片3个
      dialogImageUrl: "",
      dialogVisible: false,
      disabled: false
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("提交成功!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 图片上传3个
    handleRemove(file) {
      console.log("删除", file);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
      console.log("查看", this.dialogImageUrl);
    },
    handleDownload(file) {
      console.log("下载", file);
    },
    // 主体性质
    natureChange(e) {
      this.ruleForm.nature = e;
    },
    // 提供证件类型
    papersChange(e) {
      this.ruleForm.papers = e;
    },
    // 省份
    provinceChange(e) {
      this.ruleForm.province = e;
    },
    // 市
    downtownChange(e) {
      this.ruleForm.downtown = e;
    },
    // 区
    regionChange(e) {
      this.ruleForm.region = e;
    }
  }
};
</script>

<style scoped lang="scss">
.main {
  width: 100%;
  min-width: 70vh;
  background-color: #ebf1fb;
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  margin: auto;
  &-their {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    color: #999999;
    position: absolute;
    bottom: 28px;
  }
}
.content {
  max-width: 1920px;
  min-width: 1440px;
  margin: auto;
  margin-bottom: 145px;
  margin-top: 30px;
  &-box {
    width: 73%;
    min-width: 1022px;
    margin: auto;
    background-color: #fff;
    padding: 70px 178px 66px 0px;
  }
}


.birthday {
  display: flex;
  align-items: center;
  &-title {
    width: 150px;
    height: 46px;
    // outline: 2px solid red;
    text-align: right;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
  }
  &-option {
    height: 46px;
    // outline: 2px solid blue;
    margin-left: 20px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.checkbox {
  display: flex;
  &-title {
    width: 295px;
    // outline: 2px solid red;
    text-align: right;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
  }
  &-option {
    // outline: 2px solid blue;
    margin-left: 20px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
.elinput-left {
  width: 482px !important;
  height: 46px !important;
  margin-right: 20px;
  //  margin-bottom: 20px;
}



.uploading {
  margin-left: 170px;
  margin-bottom: 20px;
  display: flex;
  &-bg {
    width: 214px;
    height: 136px;
    display: flex;
    flex-direction: column;
    align-items: center;

    > img {
      width: 108px;
      height: 59px;
      margin-top: 28px;
      border: 1px dashed #c0ccda;
    }
    > p {
      font-size: 16px;
      font-weight: 400;
      color: #3a7bd8;
      margin-top: 15px;
    }
  }
}

.submit {
  margin-top: 80px;
  display: flex;
  justify-content: center;
  &-but {
    width: 414px;
    height: 66px;
    color: #fff;
    font-size: 20px;
    font-weight: 400;
    background: linear-gradient(135deg, #3b7ad8, #10a3e4);
    outline: none;
  }
}

:deep .el-upload--picture-card {
  width: 214px;
  height: 136px;
  // border: none;
  line-height: 0px;
}
:deep .el-form-item {
  margin-bottom: 20px;
}
</style>
